﻿@page "/datagrid-simple-filter"

@using RadzenBlazorDemos.Data
@using RadzenBlazorDemos.Models.Northwind
@using Microsoft.EntityFrameworkCore

@inject NorthwindContext dbContext

<h1>DataGrid <strong>Simple Filter Mode</strong></h1>

<RadzenExample Name="DataGridSimpleFilter" Heading="false">
    <RadzenDataGrid AllowFiltering="true" AllowColumnResize="true" 
        FilterMode="FilterMode.Simple" PageSize="5" AllowPaging="true" AllowSorting="true" Data="@employees" TItem="Employee" ColumnWidth="300px" 
        FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
        LogicalFilterOperator="LogicalFilterOperator.Or">
        <Columns>
            <RadzenDataGridColumn TItem="Employee" Property="EmployeeID" Filterable="false" Title="ID" Frozen="true" Width="50px" TextAlign="TextAlign.Center" />
            <RadzenDataGridColumn TItem="Employee" Title="Photo" Sortable="false" Filterable="false" Width="200px" >
                <Template Context="data">
                    <RadzenImage Path="@data.Photo" style="width: 40px; height: 40px; border-radius: 8px;" />
                </Template>
            </RadzenDataGridColumn>
            <RadzenDataGridColumn TItem="Employee" Property="FirstName" Title="First Name" />
            <RadzenDataGridColumn TItem="Employee" Property="LastName" Title="Last Name" Width="150px"/>
            <RadzenDataGridColumn TItem="Employee" Property="BirthDate" Title="Birth Date" FormatString="{0:d}" />
            <RadzenDataGridColumn TItem="Employee" Property="Country" Title="Country" />
            <RadzenDataGridColumn TItem="Employee" Property="Notes" Title="Notes" />
        </Columns>
    </RadzenDataGrid>
</RadzenExample>
@code {
    IEnumerable<Employee> employees;

    protected override void OnInitialized()
    {
        employees = dbContext.Employees;
    }
}